<?php
namespace app\controller;

use app\BaseController;
use think\facade\View;
class Login extends BaseController
{
	// public function index(){
	// 	return View::fetch();
	// }
    public function check(){
    	if (!$this->request->isPost()) {
    		return show(config("status.error"),"请求方式错误");
    	}
    	//参数检验   原生方式  tp6验证机制
    	$username = $this->request->param("username","","trim");
    	$password = $this->request->param("password","","trim");
    	$captcha = $this->request->param("captcha","","trim");
    	if (empty($username)||empty($password)||empty($captcha)) {
    		return show(config("status.error"),"参数不能为空");
    	}
    	//检查验证码是否正确 
    	if (!captcha_check($captcha)) {
    		return show(config("status.error"),"验证码不正确");
    	}
    	return show(config("status.success"),"登陆成功");
    }
    public function login(){
    	echo "84561";
    }

}
